package servlet;

import bean.Result;
import biz.userBiz;
import utils.Util;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.util.Map;

@WebServlet(name = "QueryUserAddressServlet", value = "/QueryUserAddressServlet.s")
public class QueryUserAddressServlet extends HttpServlet {
    private userBiz biz = new userBiz();
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        Result result;
        String uid = String.valueOf(request.getSession().getAttribute("userid"));
        try {
            Map<String, Object> map = biz.userAddress(uid);
            result = new Result(1, "查询成功!", map);
        } catch (Exception e) {
            e.printStackTrace();
            result = new Result(0, "查询失败!", null);
        }
        Util.WriteJson(result, response);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }
}
